<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../lib/vue.js"></script>
    <script src="../lib/vue-router.js"></script>
    <style>
        .header{
            background-color: brown;
            height: 80px;
        }
        html,body,h2{
            margin: 0;
            padding: 0;
        }
        .container{
            display: flex;
            height: 600px;
        }
        .left{
            background-color: lightseagreen;
            flex: 2;
        }
        .main{
            background-color: lightslategray;
            flex:8;
        }
    </style>
</head>

<body>
    <div id="app">
        <router-view></router-view>
        <div class="container">
            <router-view name="left"></router-view>
            <router-view name="main"></router-view>
        </div>
    </div>

    <script>
        var header = {
            template: '<h2 class = "header">头部组件</h2>'
        }
        var leftBox = {
            template: '<h2 class = "left">左侧组件</h2>'
        }
        var mainBox = {
            template: '<h2 class = "main">main组件</h2>'
        }
        var demo = new VueRouter({
            routes: [
                {
                    path: '/', components: {
                        'default': header,
                        'left': leftBox,
                        'main': mainBox
                    }
                }
            ]
        })
        var vm = new Vue({
            el: '#app',
            router: demo
        })
    </script>
</body>

</html>